import { createSlice } from "@reduxjs/toolkit";

const countSlice = createSlice({
  name: "count",
  initialState: {
    count: 0,
  },
  reducers: {
    addAction(state) {
      state.count ++
    },
    subAction(state) {
      state.count --
    },
    addAction2(state,action) {
        state.count += action.payload
    },
  },
});

const {addAction, subAction,addAction2} = countSlice.actions;

const countReducer = countSlice.reducer;

export {addAction, subAction, addAction2}

export default countReducer;